using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlanderCrazy : TargetCardItem
{
    private int damageTimes;

    protected override void Start()
    {
        base.Start();
        damageTimes = int.Parse(data["Arg0"]);
    }

    protected override void DealCardUse()
    {
        StartCoroutine(StartCrazy());
    }

    private IEnumerator StartCrazy()
    {
        AbstractEnemy abstractEnemy = hitEnemy;

        for (int i = 0; i < damageTimes; i++)
        {
            if (abstractEnemy == null)
            {
                StopCoroutine(StartCrazy());
                break;
            }else if(abstractEnemy.GetCurHp() > 0)
            {

                EnemyManager.Instance.DealEnemyHurt(abstractEnemy, 2);

                AudioManager.Instance.PlayEffect("sword");

                yield return new WaitForSeconds(0.2f);

            }
        }
    }
}
